<template>
  <div class="container">
        <div class="box">
            <span></span>
            <div class="content">
                <h2>{{ this.name }}</h2>
                <p>你的id:{{ this.id }}</p>
                <p>用户类型:{{ this.type }}</p>
                <a  @click="out">退出登陆</a>
            </div>
        </div>
    </div>
</template>

<script>
export default {
  name: "infoCard",
  data() {
    return {
      id: '',
      name: '',
      type: '',
      isLoaded: false // 用于触发 CSS 动画
    };
  },
  mounted() {
    this.id = localStorage.getItem('type') === 'teacher' ? localStorage.getItem('teacherId') : localStorage.getItem('studentId');
    this.name = localStorage.getItem('name');
    this.type = localStorage.getItem('type');
    this.isLoaded = true;
  },
  methods: {
    out() {
      this.$router.push('/desc')
      localStorage.clear(); 
    }
  }
};
</script>
<style lang="less" scoped>
*{
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: consolas;
}

body{
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: vh;
    background-color: #131417;
    background-image: linear-gradient(315deg, #131417 0%, #1e1f26 74%);
}

.container{
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    padding: 20px 0;
}

.box{
    position: relative;
    display: flex;
    width: 500px;
    height: 420px;
    justify-content: center;
    align-items: center;
    margin: 40px 30px;
    transition: 0.5s;
}

.content{
    position: relative;
    left: 0;
    width: 300px;
    height: 500px;
    padding: 20px 40px;
    color: #fff;
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    border-radius: 8px;
    z-index: 1;
    transition: 0.5s;
}

.content h2{
  margin-top: 100px;
    font-size: 20px;
    color: #fff;
    margin-bottom: 10px;
}

.content p{
    font-size: 20px;
    margin-bottom: 10px;
    line-height: 20px;
}

.content a{
    display: inline-block;
    font-size: 10px;
    color: #111;
    background: #fff;
    padding: 10px;
    border-radius: 4px;
    text-decoration: none;
    font-weight: 700;
    margin-top: 5px;
    transition: 0.6s;
}

.box:hover .content{
    left: -25px;
    padding: 60px 40px;
}
.box:hover h2{
  transform: scale3d(1.1,1.1,1.4);
 
  transition: transform 1s;
}

.content a:hover{
    background: #222;
    color: #fff;
    border-radius: 16px;
    box-shadow: 0 2px 15px #222;
}

.box::before{
    content: "";
    position: absolute;
    background: #fff;
    top: 0;
    left: 50px;
    width: 50%;
    height: 100%;
    text-decoration: none;
    border-radius: 8px;
    transform: skewX(15deg);
    transition: 0.5s;
}

.box::after{
    content: "";
    position: absolute;
    background: #fff;
    top: 0;
    left: 50px;
    width: 50%;
    height: 100%;
    border-radius: 8px;
    transform: skewX(15deg);
    filter: blur(30px);
    transition: 0.5s;
}

.box:hover::before,
.box:hover::after{
    transform: skewX(0deg);
    left: 20px;
    width: calc(100% - 90px);
}

.box:nth-child(1)::before,
.box:nth-child(1)::after{
    background: linear-gradient(315deg, #9603ff, #00d0ff);
}


.box span{
    display: block;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 5;
    pointer-events: none;
}

.box span::before{
    content: "";
    position: absolute;
    background: rgba(255, 255, 255, 0.1);
    top: 0;
    left: 0;
    width: 0;
    height: 0;
    opacity: 0;
    transition: 0.3s;
    backdrop-filter: blur(10px);
    border-radius: 8px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.08);
    animation: animate 2s ease-in-out infinite;
}

.box:hover span::before{
    opacity: 1;
    top: -50px;
    left: 50px;
    width: 100px;
    height: 100px;
}

.box span::after{
    content: "";
    position: absolute;
    bottom: 0;
    right: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.1);
    opacity: 0;
    transition: 0.5s;
    backdrop-filter: blur(10px);
    border-radius: 8px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.08);
    animation: animate 2s ease-in-out infinite;
    animation-delay: -1s;
}

.box:hover span::after{
    bottom: -50px;
    right: 50px;
    width: 100px;
    height: 100px;
    opacity: 1;
}

@keyframes animate {
    0%,
    100%{
        transform: translateY(10px);
    }
    50%{
        transform: translate(-10px);
    }
  }

</style> 
